Learning Kotlin Programming

Kotlin has 4 ways to access the collection element!

You have [ ], get, elementAt, and componentN. Which one to use?

Elye - A One Eye Developer
Published in
4 min readMay 10, 2020

--

Picture by Danica Tanjutco on Splash

If you’ve had to use Kotlin Collection, you probably have access to its element before. How do you do it? Which one do you use below?

  1. val value = myCollection[0]

--

--